package com.hsurosy.domain.activity.service.trial.factory;

import com.hsurosy.domain.activity.model.entity.MarketProductEntity;
import com.hsurosy.domain.activity.model.entity.TrialBalanceEntity;
import com.hsurosy.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import com.hsurosy.domain.activity.model.valobj.SkuVO;
import com.hsurosy.domain.activity.service.trial.node.RootNode;
import com.hsurosy.types.design.framework.tree.StrategyHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @Author Hsu琛君珩
 * @Date 2025-08-11 4:07
 * @Description 默认活动策略工厂
 * @Version: v1.0.0
 */
@Service
public class DefaultActivityStrategyFactory {

    // 根节点
    private final RootNode rootNode;

    public DefaultActivityStrategyFactory(RootNode rootNode) {
        this.rootNode = rootNode;
    }

    public StrategyHandler<MarketProductEntity, DefaultActivityStrategyFactory.DynamicContext, TrialBalanceEntity> strategyHandler() {
        return rootNode; // 返回根节点作为默认策略处理器
    }

    /**
     * 动态上下文信息
     */
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DynamicContext {

        private GroupBuyActivityDiscountVO groupBuyActivityDiscountVO; // 拼团活动营销配置值对象
        private SkuVO skuVO; // 商品信息

    }

}
